<template>
    <header>
        <div class="l-content">
            <el-button icon="el-icon-menu" plain size="mini" @click="handleMenu"></el-button>
            <el-breadcrumb separator="/">
                <el-breadcrumb-item v-for="item in tags" :key="item.path" :to="{ path: item.path }">{{ item.label }}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="r-content">
            <el-dropdown trigger="click" size="mini">
                <span>
                    <img class="userimg" :src="userImg">
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>个人中心</el-dropdown-item>
                    <el-dropdown-item>退出</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </header>
</template>
<script>
import { mapState } from 'vuex';
export default {
    name: 'CommonHeader',
    data() {
        return {
            userImg: require('../assets/images/user.png')
        }
    },
    methods: {
        handleMenu() {
            this.$store.commit('collapseMenu');
        }
    },
    computed: {
        ...mapState({
            tags: state => state.tab.tabList
        })
    }
}
</script>
<style lang="less" scoped>
    header {
        display: flex;
        justify-content: space-between;
        height: 100%;
        align-items: center;
    }
    .l-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .el-button {
            margin-right: 15px;
        }
    }
    .r-content {
        .userimg {
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }
    }
    .el-breadcrumb ::v-deep .el-breadcrumb__inner {
        color: white;
        font-weight: 700;
    }
</style>